package com.lizhe.config.config;

import com.lizhe.config.model.Child;
import com.lizhe.config.model.Father;
import com.lizhe.config.model.Mother;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotEmpty;

/**
 * 类描述: 加载自定义的 family.yml 配置文件，需要配合 MixPropertySourceFactory 转下
 * 前缀也需要 prefix = "family"
 *
 * @author Administrator
 * @create 2021-10-25 23:08
 */
@Data
@Component
@Validated
@ConfigurationProperties(prefix = "familyyml")
@PropertySource(value = "classpath:family.yml",factory = MixPropertySourceFactory.class)
public class FamilyYml {
    //@Value("${family.family-name}")
    @NotEmpty
    private String familyName;
    private Father father;
    private Mother mother;
    private Child child;
}
